<?php

// +----------------------------------------------------------------------
// | Description: 发布活动
// | Author:      李大明
// | Email:       limingnk@qq.com
// | DateTime:    2016-07-20 16:30:55
// +----------------------------------------------------------------------

namespace Admin\Controller;
use Think\Controller;

class PostController extends PublicController {

	public function index() {
		$userid = $this->getUserIdInCookie();
		if (IS_POST) {
			$data = array(
				'userid' => $userid,
				'activityName' => I('post.activityName'),
				'beginTime' => I('post.beginTime'),
				'endTime' => I('post.endTime'),
				'place' => I('post.place'),
				'minMember' => I('post.minMember'),
				'maxMember' => I('post.maxMember'),
				'note' => I('post.note'),
				'deadTime' => I('post.deadTime'),
			);
			$activityId = M('Activity')->add($data);
			$activityId ? $this->success('发布成功') : $this->error('发布失败');
		} else {
			$this->display();
		}
	}

}